Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use parallel unstable sort of nodes in Vicinity layer #9

Merged
merged 1 commit into from
Jan 29, 2020

Conversation

michaeljfazio
Copy link
Contributor

@michaeljfazio michaeljfazio commented Jan 28, 2020

Sorting of nodes by the Vicinity Layer is an expensive operation. A substantial speed up can be made by using a parallel unstable sort provided by the rayon crate.

@vincenthz
Copy link

thanks @michaeljfazio , this is thinking outside the box for sure ! :)

But while, it may fix the immediate problem by effectively literally throwing more cpus at it, but it's just a temporary fix and not one that address the algorithmic issue.

seems to me we should looks at:
https://github.com/primetype/poldercast/blob/master/src/poldercast/vicinity.rs#L27-L32
and
https://github.com/primetype/poldercast/blob/master/src/poldercast/vicinity.rs#L48-L53

which both transform an already ordered BTreeSet into a Vec which is then sorted with another comparison and when this is all sorted then only the beginning max items are looked at.

@NicolasDP
Copy link
Contributor

@vincenthz is right here.

The available are in a BTreeSet for it makes it easier for the ring module, however it is not efficient at all for the case of the vicinity.

Here we need to search for something more in depth. Maybe have the vicinity module keep an indexing of the available nodes to allow a fast selection of the closest nodes by topic.

Copy link
Contributor

@NicolasDP NicolasDP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow it as a temporary fix to improve the user experience while we look into something more long term

@NicolasDP NicolasDP merged commit a482ad8 into primetype:master Jan 29, 2020
@michaeljfazio
Copy link
Contributor Author

Agree with everything in this thread. Initially wanted to move to an insert sort data structure for vicinity nodes but that looked like it would be too much of a departure from how layers are currently populated. This was a low effort low risk attempt at an interim performance gain for sure 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants